/*
 * head.h
 *
 *  Created on: 2012-11-17
 *      Author: kidlet
 */

#ifndef HEAD_H_
#define HEAD_H_


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <mysql/mysql.h>
#include <signal.h>
#include <sys/types.h>
#include <unistd.h>
#include <ctime>
#include <sys/wait.h>
#include <sys/types.h>
#include <dirent.h>
#include <sys/stat.h>
#include <stdarg.h>
#include <sys/reg.h>
#include <sys/syscall.h>
#include <sys/ptrace.h>
using namespace std;

int ReadParameter ( const char *pName, char *result );
int Intial_MySQL ();
int Intial ();
const char*  GetDateTime ( const char* format );
int CheckSolutionID ( int id );
int UpdataTestData ( int pid );
int CreateWorkDir ();
void Call_Exit ( int signal );
int ComplieSourceFile ();
int Execute_SQL ( const char* query );
int Execute_CMD (const char * format, ...);
int GetFileSize(const char * filename);
int Run ( int &usedtime, int &usedmem );
void LimitResource ( int Time_Limit, int Mem_Limit );
int GetPeakMem ( int pid );
int Compare ();

#endif /* HEAD_H_ */
